package org.sith.taskrunner.gwt.client.services.user;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.google.gwt.core.client.GWT;
import org.sith.taskrunner.gwt.shared.proxy.RoleProxy;
import org.sith.taskrunner.gwt.shared.proxy.UserEntityProxy;

import java.util.List;


@RemoteServiceRelativePath("UserManageService")
public interface UsersManageGWTService extends RemoteService {

    public void addUser(UserEntityProxy user);

    public void removeUser(UserEntityProxy user);

    public void updateUser(UserEntityProxy user);

    public void updateUserActiveState(Long id, boolean active);

    public void updateUserRole(Long id,RoleProxy role);

    public UserEntityProxy getUser(Long id);

    public List<UserEntityProxy>  getUsers();

    /**
     * Utility/Convenience class.
     * Use UsersManageGWTService.App.getInstance() to access static instance of UserServiceAsync
     */
    public static class App {
        private static final UsersManageGWTServiceAsync ourInstance = (UsersManageGWTServiceAsync) GWT.create(UsersManageGWTService.class);

        public static UsersManageGWTServiceAsync getInstance() {
            return ourInstance;
        }
    }
}
